package flown.os;

/**
 * @author flown
 */

public class OSInformation
{
	public static String GetOSName()
	{
		return System.getProperty("os.name");
	}

	/**
	 * 是否Windows系统
	 * @return true or false
	 */
	public static boolean IsWindows()
	{
		String os_name = System.getProperty("os.name");
		if(os_name.startsWith(OSName.Windows.toString()))
			return true;
		return false;
	}

	/**
	 * 是否Linux系统
	 * @return true or false
	 */
	public static boolean IsLinux()
	{
		String os_name = System.getProperty("os.name");
		if(os_name.startsWith(OSName.Linux.toString()))
			return true;
		return false;
	}

	/**
	 * 取当前系统名称
	 * @return OS name
	 */
	public static OSName GetOS()
	{
		String os_name = System.getProperty("os.name");

		for (OSName name : OSName.values())
		{
			if(os_name.startsWith(name.toString()))
				return name;
		}
		
		return OSName.Others;
	}
}










